package com.smartlight.godlight.model;

import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;

public class Light implements Parcelable {
    public int id;
    public String name;
    public int img;
    public int status = 0;

    public Light(String name, int img, int status){
        this.name = name;
        this.img = img;
        this.status = status;
    }

    protected Light(Parcel in) {
        id = in.readInt();
        name = in.readString();
        img = in.readInt();
        status = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(name);
        dest.writeInt(img);
        dest.writeInt(status);
    }

    public static final Creator<Light> CREATOR = new Creator<Light>() {
        @Override
        public Light createFromParcel(Parcel in) {
            return new Light(in);
        }

        @Override
        public Light[] newArray(int size) {
            return new Light[size];
        }
    };

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public int getImg() {
        return img;
    }

    public int getStatus() {
        return status;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @NonNull
    @Override
    public String toString() {
        return "Id:" + getId() + "\n"
                + "name: " + getName() + "\n"
                + "status: " + getStatus() + "\n"
                + "img: " + getImg();

    }
}
